home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1477 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.7 KB  |  85 lines

  1. Path: oreig.uji.es!ii201
  2. From: ii201@rossegat.uji.es (Villellas Guillen Oscar)
  3. Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  4. Subject: Re: How do I define my integers?
  5. Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  6. Date: 19 Jan 1996 15:28:46 GMT
  7. Organization: Universitat Jaume I. Castell≤ de la Plana. Spain
  8. Message-ID: <4dodbe$2vf@oreig.uji.es>
  9. References: <4d73ug$25v@vixen.cso.uiuc.edu>
  10. NNTP-Posting-Host: @rossegat.uji.es
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. howard daniel joseph (djhoward@ux5.cso.uiuc.edu) wrote:
  14. >     Okay. I'm writing a program under GCC on my Amiga.
  15.  
  16. >     But I'm confused to hell over integer limits.
  17.  
  18. >     My book talks about 2 bit and 4 bit integers ... and four bit 
  19. > integers like what it describers long integers to be. Of course there's 
  20. > unsigned integers and the like too.
  21.  
  22. There are 16bits(2byte) and 32bits(4byte) integers.
  23.  
  24. > How do I declare signed versus unsigned integers?
  25.  
  26. Use the 'unsigned' keyword to declare unsigned ints.
  27.  
  28. > How do I know how many bits my integers are using?
  29.  
  30. By compiling in your compiler a program that displays
  31. sizeof(int). :)
  32.  
  33. or use the 'short' (16 bits) or 'long' (32 bits) keywords.
  34.  
  35. Examples:
  36.   unsigned short int X;  /* X is 16 bits unsigned */
  37.   short int Y;  /* Y is 16 bits signed */
  38.   unsigned long int Z; /* Z is 32 bits , unsigned */
  39.   long int Q;  /* Guess it */
  40.  
  41. > How do I declare signed and unsigned long integers?
  42. See above.
  43.  
  44. > What's with these "doubles" the book mysteriously alludes to?
  45. Maybe you're talking about 'double' types?
  46. if so, they are floating point (8 bytes, opposed to 4 bytes
  47. used by float).
  48.  
  49. > What *am* I creating when I type;
  50.  
  51. > int somevalue;
  52. > (ie Is it signed/unsigned? How many bits?)
  53. Signed. No of bits depends on your compiler/compilation
  54. flags.
  55.  
  56. > I know many of the answers here, but if I could get them all from one 
  57. > source I'd feel a lot better.
  58.  
  59. > I need two sorts of values for my project;
  60.  
  61. > An integer (unsigned) that can handle, 6, though ideally 9 places (Just 
  62. > under 250000000 would be the maximum forseen possible value here.)
  63.  long ints would do a good job.
  64.  
  65. > An integer that can handle a much bigger number ... 12 places at least for 
  66. > now.
  67.  
  68.     Sorry, there's not a type to accomodate such a beast.
  69.     Are you sere you need all of them???
  70.  
  71. > Can I perform simple maths (addition, division) between integers of 
  72. > different types? I'd assume so, right?
  73.  
  74. Yes, I think...
  75.  
  76. --
  77.                    //\\\
  78.                    /o \\
  79.         +-----oooO--(_)--Oooo-----+        _ _
  80.         | Oscar Villellas Guillen |       ////
  81.         +-------------------------+  _ _ ////
  82.                    | | |             \\\X///
  83.                   ooO Ooo             \XXX/ Always...
  84.            ii201@rossegat.uji.es
  85.